<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-12-14 20:42:55
 * @LastEditors: charles
 * @LastEditTime: 2021-12-14 21:02:59
-->
<template>
  <div class="login">
    <div class="header">
      <div class="logo">七组</div>
      <div class="title">大气环境监测平台</div>
    </div>
    <div class="form">
      <van-cell-group>
        <van-field
          v-model="form.username"
          required
          clearable
          label="用户名"
          icon="question-o"
          placeholder="请输入用户名"
        />
        <van-field
          v-model="form.password"
          type="password"
          label="密码"
          placeholder="请输入密码"
          required
        />
      </van-cell-group>
      <div style="text-align: center; padding: 1em">
        <van-button
          plain
          round
          @click="loginHandler"
          style="
            width: 75%;
            background-color: #f5a31f;
            margin-top: 70px;
            font-size: 17px;
          "
          >登录</van-button
        >
      </div>
    </div>
  </div>
</template>
<script>
import { mapActions } from "vuex";
export default {
  data() {
    return {
      form: {
        type: "customer",
      },
    };
  },
  methods: {
    ...mapActions("user", ["login"]),
    loginHandler() {
      this.login(this.form).then(() => {
        //跳转到首页
        this.$router.push({ path: "/manager/home" });
      });
    },
  },
};
</script>
<style scoped>
.header {
  height: 140px;
  padding: 50px;
  color: #544847;
  /* background-color: #1659a0; */
  background: #ebe1b2;
  text-align: center;
}
.header .logo {
  width: 80px;
  height: 80px;
  line-height: 80px;
  border-radius: 50%;
  border: 1px solid #6f5750;
  margin: 0 auto;
  color: #544847;
  /* color: #efefef; */
  font-weight: bold;
  margin-bottom: 1em;
  font-size: 2em;
}
.header .title {
  font-size: 24px;
}
</style>